package domain;

/**
 * Created by IntelliJ IDEA.
 * User: TuarnOte
 * Date: 11/13/11
 * Time: 1:31 AM
 * To change this template use File | Settings | File Templates.
 */
public class Ozenki {
    String action;
    String username;
    String password;
    String recipient;
    String messageType;
    String messageData;
    String url;
    Integer port;

    public Ozenki(String _recipient) {
        action = "sendmessage";
        username = "admin";
        password = "abc123";
        recipient = _recipient;
        messageType = "SMS%3ATEXT";
        url = "192.168.192.37";
        port = 9501;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRecipient() {
        return recipient;
    }

    public void setRecipient(String recipient) {
        this.recipient = recipient;
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getMessageData() {
        return messageData;
    }

    public void setMessageData(String messageData) {
        this.messageData = messageData;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getSendMessageRequest(String msgdata) {
        messageData = msgdata;

        String request = "http://";
        String ampersan = "&";

        request = request.concat(url);            // http://localhost
        request = request.concat(":" + port);     // http://localhost:9501
        request = request.concat("/api?");        // http://localhost:9501/api?
        request = request.concat("action=" + action);     // http://localhost:9501/api?action=sendmessage
        request = request.concat(ampersan+"username="+username);  //http://localhost:9501/api?action=sendmessage&username=admin
        request = request.concat(ampersan+"password="+password);  //http://localhost:9501/api?action=sendmessage&username=admin&password=abc123
        request = request.concat(ampersan+"recipient="+recipient);  //http://localhost:9501/api?action=sendmessage&username=admin&password=abc123&recipient=xxxxxxxxxx
        request = request.concat(ampersan+"messagetype="+messageType);  //http://localhost:9501/api?action=sendmessage&username=admin&password=abc123&recipient=xxxxxxxxxx&messagetype=SMS:TEXT
        request = request.concat(ampersan+"messagedata="+messageData);  //http://localhost:9501/api?action=sendmessage&username=admin&password=abc123&recipient=xxxxxxxxxx&messagetype=SMS:TEXT&messagedata

//        System.out.print(request);
        return request;

    }
}
